package proxy;

import java.lang.reflect.Proxy;

public class MainTest10 {
    public static void main(String[] args) {
//        RealSubject realSubject = new RealSubject();
//        ProxySubject proxySubject = new ProxySubject(realSubject);
//        proxySubject.proxy();

        Subject realSubject = new RealSubject();
        ProxyHandler handler = new ProxyHandler(realSubject);
        Subject subject = (Subject) Proxy.newProxyInstance(RealSubject.class.getClassLoader(),
                RealSubject.class.getInterfaces(), handler);
        subject.sellBook();
    }
}
